//
//  GdSubView.m
//  上海杨浦
//
//  Created by FrankChen on 13-5-24.
//  Copyright (c) 2013年 FrankChen. All rights reserved.
//

#import "GdSubView.h"

@implementation GdSubView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        //[self setBackgroundColor:[UIColor grayColor]];
        //
        [self setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bgImg_cell.png"]]];
    }
    return self;
}


-(void) AddImageView:(int)flag{
    UIImageView *imageView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
    [imageView setBackgroundColor:[UIColor blueColor]];
    [self AddLabel:imageView:flag];
    [self addSubview:imageView];
}

-(void) AddLabel:(UIImageView *)imageView :(int)flag{
    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(124, 1, 80, 28)];
    UIFont *font=[UIFont fontWithName:@"FZHTJW--GB1-0" size:18.0f];
    [label setFont:font];
    [label setBackgroundColor:[UIColor blueColor]];
    [label setTextColor:[UIColor whiteColor]];
    switch (flag) {
        case 1:{
            [label setText:@"关于我们"];
            break;}
        case 2:{
            [label setText:@"技术支持"];
            break;}
    }
    [imageView addSubview:label];
}

-(void) AddBackBtn{
    UIButton *btn_back = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn_back setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateNormal];
    btn_back.frame = CGRectMake(15, 1, 72, 29);
    [btn_back addTarget:self action:@selector(Btn_Back_Clicked) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btn_back];
}

-(void)Btn_Back_Clicked{
    
    [self removeFromSuperview];
}

-(void)AddGYWM{
    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(25, 1, 270, 300)];
    UIFont *font=[UIFont fontWithName:@"FZHTJW--GB1-0" size:16.0f];
    [label setBackgroundColor:[UIColor clearColor]];
    [label setFont:font];
    [label setNumberOfLines:0];
    [label setLineBreakMode:NSLineBreakByCharWrapping];
    [label setTextColor:[UIColor darkGrayColor]];
    [label setText:@"      本产品是上海市杨浦区区政府为\niphone用户定制的客户端应用程序、通过文字、图片介绍等，向您介绍上海市杨浦区的各类新闻信息服务发展情况，让生活在上海市杨浦区的居民们对于居住、生活、娱乐、新政等有更充分的了解和认识、希望这些栏目能够给您带来帮助。\n\n          上海市杨浦区人民政府办公室"];
    [self addSubview:label];
}

-(void)AddJSZC{
    UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(92, 90, 135, 135)];
    [imageView setImage:[UIImage imageNamed:@"usst.png"]];
    [self addSubview:imageView];
    
    UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, 220, 320, 40)];
    UIFont *font=[UIFont fontWithName:@"FZHTJW--GB1-0" size:15.0f];
    [label setBackgroundColor:[UIColor clearColor]];
    [label setFont:font];
    [label setTextAlignment:NSTextAlignmentCenter];
    [label setTextColor:[UIColor darkGrayColor]];
    [label setText:@"USST上海理工大学"];
    [self addSubview:label];
}

-(void)ShowView:(int)flag{
    [self AddImageView:flag];
    [self AddBackBtn];
    switch (flag) {
        case 1:
            [self AddGYWM];
            break;
            
        case 2:
            [self AddJSZC];
            break;
    }
}



@end



















